<?php
require_once "library/Login.php";
require_once "library/Medoo.php";

use Medoo\Medoo;
use web\lib\Login;

$username = $_POST['user'];
$password = $_POST['pass'];
// $username = 'zhangsan';
// $password = md5('pwd');
$db   = new Medoo();
$join = new Login($db);

$result = $join->signIn($username, $password);

if (!isset($_COOKIE['user_id'])) {
    setcookie('user_id', $username);
}

echo json_encode($result);
